package au.com.introprogexercise.core.excercises;

/**
 * Created by olga on 30/05/14.
 */
public class TriangleExercise
{
    public static void printSingleAsteriskToConsole()
    {
        System.out.print("*");
    }

    public static void printSingleAsteriskToConsoleWithCarriageReturn()
    {
        System.out.println("*");
    }

    public void drawHorisontalLineWithAsterisks( int numberOfAsterisks )
    {
        for( int i = 0; i < (numberOfAsterisks - 1); i++ )
        {
            printSingleAsteriskToConsole();
        }
        printSingleAsteriskToConsoleWithCarriageReturn();
    }

    public void drawVerticalLineWithAsterisks( int numberOfRows )
    {
        for( int i = 0; i < numberOfRows; i++ )
        {
            printSingleAsteriskToConsoleWithCarriageReturn();
        }
    }

    public void drawRightRectangle( int numberOfRows )
    {
        int asteriskNumber = 1;
        while (asteriskNumber <= numberOfRows)
        {
            drawHorisontalLineWithAsterisks(asteriskNumber);
            asteriskNumber++;
        }
    }
}
